package com.small.admin.entity;

import com.small.common.util.val.group.ValAdd;
import com.small.common.util.val.group.ValUpdate;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * 作者: fenny
 * 邮箱: 893146555@qq.com
 * 时间: 2017-11-01 08:40:33
 * 描述: 字典
 */
@Data
@Table(name = "t_dictionaries")
public class Dictionaries implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NotNull(groups = ValUpdate.class)
    private Long id;

    //父级ID
    @Column(name = "parent_id")
    @NotNull(groups = {ValAdd.class, ValUpdate.class})
    @Min(groups = {ValAdd.class, ValUpdate.class}, value = 1)
    private Long parentId;

    //名称
    @Column(name = "name")
    @NotEmpty(groups = {ValAdd.class})
    @Length(groups = {ValAdd.class, ValUpdate.class}, min = 1, max = 30)
    private String name;

    //1正常0禁用
    @Column(name = "state")
    @NotNull(groups = ValAdd.class)
    @Min(value = 0, groups = {ValAdd.class, ValUpdate.class})
    @Max(value = 1, groups = {ValAdd.class, ValUpdate.class})
    private Integer state;

    //排序值
    @Column(name = "orderline")
    private Long orderline;

    //创建人
    @Column(name = "cid")
    private Long cid;

    //创建时间
    @Column(name = "ctime")
    private Long ctime;

}
